package com.example.elasticsearch.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "bills",
        shards = 1, // 默认索引分区数
        replicas = 0// 每个分区的备份数
         )
public class Bill {
    @Id
    private String id;

    @Field(type = FieldType.Text)
    private String billno;

    private String bankGateWayCode;

    private String bankcode;

    //    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "uuuu-MM-dd'T'HH:mm:ss.SSSX")
    @Field(type = FieldType.Date, format = DateFormat.date_optional_time)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd'T'HH:mm:ss.SSSZ",timezone="GMT+8")
    private Date create_date;

    @Field(type = FieldType.Double)
    private double amount;

    private String orderType;


    private String channel;

    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBillno() {
        return billno;
    }

    public void setBillno(String billno) {
        this.billno = billno;
    }

    public String getBankGateWayCode() {
        return bankGateWayCode;
    }

    public void setBankGateWayCode(String bankGateWayCode) {
        this.bankGateWayCode = bankGateWayCode;
    }

    public String getBankcode() {
        return bankcode;
    }

    public void setBankcode(String bankcode) {
        this.bankcode = bankcode;
    }

    public Date getCreate_date() {
        return create_date;
    }

    public void setCreate_date(Date create_date) {
        this.create_date = create_date;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    @Override
    public String toString() {
        return "Bill{" +
                "id='" + id + '\'' +
                ", billno='" + billno + '\'' +
                ", bankGateWayCode='" + bankGateWayCode + '\'' +
                ", bankcode='" + bankcode + '\'' +
                ", create_date=" + create_date +
                ", amount=" + amount +
                '}';
    }
}
